$(document)
		.ready(
				function() {
					// 初始化生产计划的数据绑定
					var productionPlanVue = new Vue({
						el : '#productionPlanDiv',
						data : {
							items : null
						},
						methods : {
							onclick : function(plan) {
								// 打开审核的弹窗
								openExameProductionPlanBox(plan);
							}
						}
					});

					// 获得未审核的生产计划
					getProductionplanNotExame();
					// 获得未审核的生产计划的列表
					function getProductionplanNotExame() {
						var data = {
							"state" : 1
						};
						baseUtil.httpSend(
								"productionPlan/getProductionPlanByStateAjax",
								data, showProductionPlan);
					}

					// 打开审核的弹窗
					function openExameProductionPlanBox(plan) {
						var exameProductionPlanBox = layer
								.open({
									type : 2,
									maxmin : true,
									title : '审核生产计划',
									offset : '4%',
									btnAlign : 'c',
									area : [ '70%', '92%' ],
									btn : [ '通过', '未通过' ] // 只是为了演示
									,
									yes : function() {
										// 获得子窗口的值
										var childBox = layer.getChildFrame(
												'body', exameProductionPlanBox);
										// 新添加的菜品
										var exameSuggestion = childBox.find(
												"#inputExameSuggestion").val();

										var data = {
											"productionPlanId" : plan.productionPlanId,
											"exame" : 2,
											"exameSuggestion" : exameSuggestion
										};
										
										baseUtil.httpSend("productionPlan/exameProductionPlanAjax",data, showExameResult);
										layer.close(exameProductionPlanBox);
										
									},
									btn2 : function() {
										// 获得子窗口的值
										var childBox = layer.getChildFrame(
												'body', exameProductionPlanBox);
										// 新添加的菜品
										var exameSuggestion = childBox.find(
												"#inputExameSuggestion").val();

										var data = {
											"productionPlanId" : plan.productionPlanId,
											"exame" : 3,
											"exameSuggestion" : exameSuggestion
										};

										baseUtil
												.httpSend(
														"productionPlan/exameProductionPlanAjax",
														data, showExameResult);

										layer.close();
									},
									shadeClose : true, // 点击遮罩关闭
									content : SERVER_PRE_URL+'productionPlan/getProductionPlanByPrimaryKeyReturnTo?productionPlanId='
											+ plan.productionPlanId
											+ "&returnTo=showProductionPlan&remark=exame"
								});
					}

					function showExameResult(data) {
						if (data == 1) {
							layer.msg('审核成功');
							getProductionplanNotExame();

						} else {
							layer.msg('审核成功');
						}

					}

					function showProductionPlan(data) {
						Vue.set(productionPlanVue, "items", data);
					}

				});